﻿@model ABCTile.ViewModel.TileIndexData

@{
    ViewBag.Title = "Index";
}

@Html.ActionLink("Tile", "Index", "Tile") |
@Html.ActionLink("Manufacture", "Index", "Manufacture") |
@Html.ActionLink("Color", "Index", "Color") |
@Html.ActionLink("Shape", "Index", "Shape") | 



<h2>Tile List</h2>

@using (Html.BeginForm())
{
    <table>
        <tr>
            <th>Manufacture</th>
            <th>Color</th>
            <th>Shape</th>
            <th></th>
        </tr>
        <tr>
            <td>@Html.DropDownList("ManufactureID", String.Empty)</td>
            <td>@Html.DropDownList("ColorID", String.Empty)</td>
            <td>@Html.DropDownList("ShapeID", String.Empty)</td>
            <td><input type="submit" value = "Search" /></td>
        </tr>
    </table>
}
<p>
    @Html.ActionLink("Create New Tile", "Create")
</p>
<table>
    <tr>
        <th>
            Series
        </th>
        <th>
            SizeX
        </th>
        <th>
            SizeY
        </th>
        <th>
            Description
        </th>
        <th>
            Color
        </th>
        <th>
            Shape
        </th>
        <th>
            Mannufacture
        </th>
        <th></th>
    </tr>
@if (Model.PagedTiles != null && Model.PagedTiles.Count > 0)
{
    foreach (var item in Model.PagedTiles)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Series)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.SizeX)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.SizeY)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Description)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Color.ColorName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Shape.ShapeName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Mannufacture.Name)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.TileID }) |
                @Html.ActionLink("Details", "Details", new { id = item.TileID }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.TileID })
            </td>
        </tr>
    }
}

</table>
<div>
    Page @(Model.PagedTiles.PageCount < Model.PagedTiles.PageNumber ? 0 : Model.PagedTiles.PageNumber)
    of @Model.PagedTiles.PageCount
    &nbsp;
    @if (Model.PagedTiles.HasPreviousPage)
    {
        @Html.ActionLink("<<", "Index", new { page = 1})
        @Html.Raw("&nbsp;");
        @Html.ActionLink("< Prev", "Index", new { page = Model.PagedTiles.PageNumber - 1 })
    }
    else
    {
        @: <<
    @Html.Raw("&nbsp;");
        @: < Prev
    }
    &nbsp;
    @if (Model.PagedTiles.HasNextPage)
    {
        @Html.ActionLink("Next > ", "Index", new { page = Model.PagedTiles.PageNumber + 1 })
        @Html.Raw("&nbsp;");
        @Html.ActionLink(">>", "Index", new { page = Model.PagedTiles.PageCount })
    }
    else
    {
        @:Next >
        @Html.Raw("&nbsp;") 
        @:>>
    }
</div>

